home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 160 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: library.erc.clarkson.edu!rpi!not-for-mail
  2. From: Dave Nulton <dnult@axiom.net>
  3. Newsgroups: comp.lang.c++.moderated,comp.lang.c++
  4. Subject: Re: Meaning of the specifier volatile?
  5. Date: 2 Jan 1996 11:39:47 -0000
  6. Organization: Axiom Communications
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: kanze@gabi-soft.fr
  9. Message-ID: <4cb5i3$5mr@netlab.cs.rpi.edu>
  10. References: <4c9740$27n@netlab.cs.rpi.edu>
  11. NNTP-Posting-Host: netlab.cs.rpi.edu
  12.  
  13. X-Original-Date: 2 Jan 1996 07:22:26 GMT
  14.  
  15. I'm no expert but here is what I know.  The specifier volatile is 
  16. a directive to the compiler that the variable declared volatile 
  17. can change at any moment.  The compiler will then make no 
  18. assumptions about the contents of this variable, and will always 
  19. re-check its value when used.  An example of something that might 
  20. use volatile variables is:  a hardware interface to your PC which 
  21. reads analog data and converts it to digital.  Your program may 
  22. read the data from the PC bus.  However this data is always 
  23. changing and your program should make know assumptions that the 
  24. data is the same - it should always recheck the value.
  25.  
  26. I'm sure there are other less complicated applications which may 
  27. benefit from volatile variables.  I'm sure one of the many other 
  28. experts on the net can elaborate.
  29.  
  30. -dnult@axiom.net
  31.  
  32.  
  33.     [ comp.lang.c++.moderated is a moderated newsgroup.  Submit articles ]
  34.     [  to <c++-submit@netlab.cs.rpi.edu>.  The moderation policy can be  ]
  35.     [   retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>.   ]
  36.     [    Moderators can be reached at: c++-request@netlab.cs.rpi.edu.    ]
  37.